Lab Overview

Bode diagram — gain and phase margins (Fig. 6)
PI step response — simulation (Fig. 1)
PI step response — hardware (Fig. 2)

Frequency-Domain Analysis & Controller Design

The plant transfer function P_i(s) = K / [s(τs+1)] was evaluated in frequency domain. The magnitude is |P_i(jω)| = K / [ω√(1 + (τω)²)]. The Bode plot shows a pole at the origin (−20 dB/decade slope) and a second pole at ω = 1/τ = 39.4 rad/s. Phase starts at −90° and approaches −180° asymptotically, never crossing −180° → Gain Margin = ∞. Phase Margin = 87.8° at the gain crossover of 1.53 rad/s. Since one pole is at s = 0, P_i(s) is marginally stable.

The PI controller adds an integrator to eliminate steady-state error for step references and uses the proportional gain for transient shaping. The lead compensator adds phase lead to improve transient response while maintaining stability margins. Both were tuned in Simulink and then deployed to the SRV02 hardware via the QUARC interface.

Lead step response — simulation (Fig. 4)
Lead step response — hardware (Fig. 5)
PI ripple — signal noise analysis (Fig. 3)

Results & Analysis

Controller / Test t_p (s) PO (%) e_ss (rad/s)
PI — simulation0.044.40
PI — hardware0.03423.8−3.17×10⁻⁵
Lead — simulation0.042.00
Lead — hardware0.0344.4−0.0012
PI vs Lead overshoot comparison
Ripple analysis — measured vs theoretical
Full summary table (Table 1)

MATLAB Code

The Bode plot was generated using MATLAB's margin() function on the P_i(s) transfer function. Response plots overlaid setpoint and measured speed. Full script: Lab 5 Appendix A.

% Plant with integrator: Pi(s) = K / [s(tau*s + 1)]
K   = 1.53;
tau = 0.0254;
s   = tf('s');
PI  = K / (s * (tau*s + 1));
margin(PI)    % Gm = Inf, Pm = 87.8 deg at 1.53 rad/s

% Speed response plot
figure()
plot(data_spd(:,1), data_spd(:,2))   % setpoint
hold on
plot(data_spd(:,1), data_spd(:,3))   % measured
xlabel('Time (s)');  ylabel('Speed (rad/s)')
title('Step response implementation with Lead Control')
legend('Setpoint', 'Measured', Location='northwest')

% Steady-state error over settling window
index = (time >= 4.9) & (time <= 9.9);
e_ss  = mean(r(index)) - mean(y(index));   % ≈ -3.17e-5 rad/s (PI)
Full MATLAB script — Lab 5 Appendix A
PI controller Simulink speed loop
Lead compensator Simulink block

← Back to Dynamics & Control Labs